<div class="full_w">
    <div class="h_title"><?php echo Yii::t('AdmincpModule.admincp', 'Add Email Template'); ?></div>
    <form action="" method="post" id="frm">
    	
        <fieldset>
        	<legend>Template Information</legend>
            <div class="element">
                <label>Template Code <span class="red">*</span></label>
                <input type="text" name="template[template_code]" id="template_code" class="text required" value="<?php echo isset($arrItemInfo['template_code'])?$arrItemInfo['template_code']:null; ?>">
            </div>
            <div class="element">
                <label>Template Name <span class="red">*</span></label>
                <input type="text" name="template[template_name]" id="template_name" class="text required" value="<?php echo isset($arrItemInfo['template_name'])?$arrItemInfo['template_name']:null; ?>">
            </div>
            <div class="element">
                <label>Template Description <span class="red">*</span></label>
                <textarea name="template[template_description]" id="template_description" class="textarea"><?php echo isset($arrItemInfo['template_description'])?$arrItemInfo['template_description']:null; ?></textarea>
            </div>
       </fieldset>
       <fieldset>
            <legend>Template Details</legend>
            <div class="element">
                <label>Sender Name <span class="red">*</span></label>
                <input type="text" name="template[template_sender_name]" id="template_sender_name" class="text" value="<?php echo isset($arrItemInfo['template_sender_name'])?$arrItemInfo['template_sender_name']:null; ?>">
            </div>
            <div class="element">
                <label>Sender Email <span class="red">*</span></label>
                <input type="text" name="template[template_sender_email]" id="template_sender_email" class="text" value="<?php echo isset($arrItemInfo['template_sender_email'])?$arrItemInfo['template_sender_email']:null; ?>">
            </div>
            <div class="element">
                <label>Subject <span class="red">*</span></label>
                <input type="text" name="template[template_subject]" id="template_subject" class="text required" value="<?php echo isset($arrItemInfo['template_subject'])?$arrItemInfo['template_subject']:null; ?>">
            </div>
            <div class="element">
                <label>Body <span class="red">*</span></label>
                <textarea name="template[template_body]" id="template_body" class="textarea required" style="height:200px;"><?php echo isset($arrItemInfo['template_body'])?$arrItemInfo['template_body']:null; ?></textarea>
            	[<a class="fancybox" onclick="Media.show({callback: function(src){$('#template_body').val(src); $.fancybox.close();}, folder: 'email-template'});" href="javascript:void(0);">Media</a>] 
            	<?php if(isset($arrItemInfo['template_id'])): ?>[<a href="<?php echo LINK_ADMINCP_EMAILTEMPLATES;?>/preview/?id=<?php echo $arrItemInfo['template_id']; ?>" target="_blank">Preview</a>]<?php endif; ?>
            </div>
        </fieldset>
        <div class="entry">
            <input type="hidden" name="id" id="id" value="<?php echo isset($arrItemInfo['template_id'])?$arrItemInfo['template_id']:null; ?>">
            <button type="submit">Submit</button> <button>Cancel</button>
        </div>
    </form>
</div>
<script type="text/javascript" src="js/media-popup.js"></script>
<script type="text/javascript" src="../libs/ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="js/ckeditor_configs.js"></script>
<script type="text/javascript">
	$(function(){
		CKEDITOR.replace( 'template_body', ck_full_editor);
		$('#frm').validate();
	});
</script>